mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 22:43:17 +02:00
Usleep() is not found in all versions of MinGW, use Sleep() on Windows
Handle long sleeps on non-Windows correctly. Corresponding to flashrom svn r1667. Signed-off-by: Maksim Kuleshov <mmcx@mail.ru> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:

committed by
Carl-Daniel Hailfinger

parent
02437458a6
commit
73dc0db725
18
udelay.c
18
udelay.c
@ -169,13 +169,23 @@ recalibrate:
|
||||
msg_pinfo("OK.\n");
|
||||
}
|
||||
|
||||
/* Not very precise sleep. */
|
||||
void internal_sleep(int usecs)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
Sleep((usecs + 999) / 1000);
|
||||
#else
|
||||
sleep(usecs / 1000000);
|
||||
usleep(usecs % 1000000);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Precise delay. */
|
||||
void internal_delay(int usecs)
|
||||
{
|
||||
/* If the delay is >1 s, use usleep because timing does not need to
|
||||
* be so precise.
|
||||
*/
|
||||
/* If the delay is >1 s, use internal_sleep because timing does not need to be so precise. */
|
||||
if (usecs > 1000000) {
|
||||
usleep(usecs);
|
||||
internal_sleep(usecs);
|
||||
} else {
|
||||
myusec_delay(usecs);
|
||||
}
|
||||
|
Reference in New Issue
Block a user