3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 /* This will keep track of how many ticks that the system
25 * has been running for */
26 unsigned long timer_ticks
= 0;
28 /* Software timer - ticks count to 1ms */
29 unsigned long timer_swticks
= 0;
31 /* This will continuously loop until the given time has
33 void timer_wait (int ticks
)
37 eticks
= timer_ticks
+ ticks
;
39 while (timer_ticks
< eticks
)
43 char *time_tostring (unsigned long s
)
50 printf ("Uptime: %s\n", time_tostring (timer_ticks
/((3579545L / 3) / HZ
)));
55 /* Kernel with 1000Hz timer - dont need it ? */
56 if (kernel_attr
& KERNEL_18HZ
) {
59 eticks
= timer_ticks
+ 18;
61 while (timer_ticks
< eticks
) {
66 kprintf ("Freqency: %lluHz\n", ctps
);
72 unsigned long timer
= timer_ticks
;
74 while ((timer_ticks
- timer
) >= 1)
78 void usleep (unsigned len
)
80 if (kernel_attr
& KERNEL_18HZ
) {
81 unsigned long long t
= ctps
* len
;
82 unsigned long long i
= 0;
93 unsigned int timer_install ()