* THE SOFTWARE.
*/
-#include <stdint.h>
-#include <string.h>
-#include <stdio.h>
+#include "qemu/osdep.h"
#include <glib.h>
ide_test_quit();
}
-static void test_pci_retry_flush(const char *machine)
+static void test_pci_retry_flush(void)
{
test_retry_flush("pc");
}
-static void test_isa_retry_flush(const char *machine)
+static void test_isa_retry_flush(void)
{
test_retry_flush("isapc");
}
static uint8_t ide_wait_clear(uint8_t flag)
{
- int i;
uint8_t data;
+ time_t st;
/* Wait with a 5 second timeout */
- for (i = 0; i <= 12500000; i++) {
+ time(&st);
+ while (true) {
data = inb(IDE_BASE + reg_status);
if (!(data & flag)) {
return data;
}
+ if (difftime(time(NULL), st) > 5.0) {
+ break;
+ }
nsleep(400);
}
g_assert_not_reached();
static void ide_wait_intr(int irq)
{
- int i;
+ time_t st;
bool intr;
- for (i = 0; i <= 12500000; i++) {
+ time(&st);
+ while (true) {
intr = get_irq(irq);
if (intr) {
return;
}
+ if (difftime(time(NULL), st) > 5.0) {
+ break;
+ }
nsleep(400);
}