- 论坛徽章:
- 0
|
在ide-iops.c中有如下代码:- static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat)
- {
- unsigned long flags;
- int i;
- u8 stat;
- udelay(1); /* spec allows drive 400ns to assert "BUSY" */
- stat = ide_read_status(drive);
- if (stat & BUSY_STAT) {
- local_irq_set(flags);
- timeout += jiffies;
- while ((stat = ide_read_status(drive)) & BUSY_STAT) {
- if (time_after(jiffies, timeout)) {
- /*
- * One last read after the timeout in case
- * heavy interrupt load made us not make any
- * progress during the timeout..
- */
- stat = ide_read_status(drive);
- if (!(stat & BUSY_STAT))
- break;
- local_irq_restore(flags);
- *rstat = stat;
- return -EBUSY;
- }
- }
- local_irq_restore(flags);
- }
- /*
- * Allow status to settle, then read it again.
- * A few rare drives vastly violate the 400ns spec here,
- * so we'll wait up to 10usec for a "good" status
- * rather than expensively fail things immediately.
- * This fix courtesy of Matthew Faupel & Niccolo Rigacci.
- */
- for (i = 0; i < 10; i++) {
- udelay(1);
- stat = ide_read_status(drive);
- if (OK_STAT(stat, good, bad)) {
- *rstat = stat;
- return 0;
- }
- }
- *rstat = stat;
- return -EFAULT;
- }
复制代码 这时为什么判断BSY位是单独做的,等判断它被清除之后,然后再读取判断DRDY以及DRQ等?并且判断BSY和其它位之间至少会等待10us再读一次Status Register? |
|