xref: /titanic_44/usr/src/grub/grub-0.97/netboot/timer.c (revision 1b8adde7ba7d5e04395c141c5400dc2cffd7d809)
1*1b8adde7SWilliam Kucharski /* A couple of routines to implement a low-overhead timer for drivers */
2*1b8adde7SWilliam Kucharski 
3*1b8adde7SWilliam Kucharski  /*
4*1b8adde7SWilliam Kucharski  * This program is free software; you can redistribute it and/or
5*1b8adde7SWilliam Kucharski  * modify it under the terms of the GNU General Public License as
6*1b8adde7SWilliam Kucharski  * published by the Free Software Foundation; either version 2, or (at
7*1b8adde7SWilliam Kucharski  * your option) any later version.
8*1b8adde7SWilliam Kucharski  */
9*1b8adde7SWilliam Kucharski #include        "grub.h"
10*1b8adde7SWilliam Kucharski #include	"timer.h"
11*1b8adde7SWilliam Kucharski 
12*1b8adde7SWilliam Kucharski /* Machine Independant timer helper functions */
13*1b8adde7SWilliam Kucharski 
mdelay(unsigned int msecs)14*1b8adde7SWilliam Kucharski void mdelay(unsigned int msecs)
15*1b8adde7SWilliam Kucharski {
16*1b8adde7SWilliam Kucharski 	unsigned int i;
17*1b8adde7SWilliam Kucharski 	for(i = 0; i < msecs; i++) {
18*1b8adde7SWilliam Kucharski 		udelay(1000);
19*1b8adde7SWilliam Kucharski 		poll_interruptions();
20*1b8adde7SWilliam Kucharski 	}
21*1b8adde7SWilliam Kucharski }
22*1b8adde7SWilliam Kucharski 
waiton_timer2(unsigned int ticks)23*1b8adde7SWilliam Kucharski void waiton_timer2(unsigned int ticks)
24*1b8adde7SWilliam Kucharski {
25*1b8adde7SWilliam Kucharski 	load_timer2(ticks);
26*1b8adde7SWilliam Kucharski 	while(timer2_running()) {
27*1b8adde7SWilliam Kucharski 		poll_interruptions();
28*1b8adde7SWilliam Kucharski 	}
29*1b8adde7SWilliam Kucharski }
30