X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdevices%2Fdisk.c;h=234d5a952d3a03b27295b9c6bcb62a11d0b238e4;hb=275c68384d654e4c1f9ac4a3eadd2c3d4e46cf86;hp=d8bed65343e16a2b91c6d41aea8b7771877444fc;hpb=5aa19f8c89021f712c6aa4ea275b2be8c980503c;p=pintos-anon diff --git a/src/devices/disk.c b/src/devices/disk.c index d8bed65..234d5a9 100644 --- a/src/devices/disk.c +++ b/src/devices/disk.c @@ -255,12 +255,12 @@ reset_channel (struct channel *c) /* Issue soft reset sequence, which selects device 0 as a side effect. Also enable interrupts. */ outb (reg_ctl (c), 0); - timer_usleep (10); + timer_sleep (timer_us2ticks (10)); outb (reg_ctl (c), CTL_SRST); - timer_usleep (10); + timer_sleep (timer_us2ticks (10)); outb (reg_ctl (c), 0); - timer_msleep (150); + timer_sleep (timer_ms2ticks (150)); /* Wait for device 0 to clear BSY. */ if (present[0]) @@ -279,7 +279,7 @@ reset_channel (struct channel *c) { if (inb (reg_nsect (c)) == 1 && inb (reg_lbal (c)) == 1) break; - timer_msleep (10); + timer_sleep (timer_ms2ticks (10)); } wait_while_busy (&c->devices[1]); } @@ -445,7 +445,7 @@ wait_until_idle (const struct disk *d) { if ((inb (reg_status (d->channel)) & (STA_BSY | STA_DRQ)) == 0) return; - timer_usleep (10); + timer_sleep (timer_us2ticks (10)); } printf ("%s: idle timeout\n", d->name); @@ -471,7 +471,7 @@ wait_while_busy (const struct disk *d) printf ("ok\n"); return (inb (reg_alt_status (c)) & STA_DRQ) != 0; } - timer_msleep (10); + timer_sleep (timer_ms2ticks (10)); } printf ("failed\n"); @@ -488,7 +488,7 @@ select_device (const struct disk *d) dev |= DEV_DEV; outb (reg_device (c), dev); inb (reg_alt_status (c)); - timer_nsleep (400); + timer_sleep (timer_ns2ticks (400)); } /* Select disk D in its channel, as select_device(), but wait for