Improve timeout management logic.
This commit is contained in:
@@ -129,7 +129,7 @@ _header DD -1 ; link to the next device
|
||||
DW DGROUP:STRATEGY ; address of the strategy routine
|
||||
DW DGROUP:INTERRUPT; " " " interrupt "
|
||||
DB 1 ; number of drives
|
||||
DB 'SDCDv12' ; DOS doesn't really use these bytes
|
||||
DB 'SDCDv13' ; DOS doesn't really use these bytes
|
||||
|
||||
; The geometry (sectors/track, tracks/cylinder) defined in the BPB is rather
|
||||
; arbitrary in the case of the TU58, but there are things to watch out for.
|
||||
|
||||
@@ -254,14 +254,13 @@ int wait_ready (void) /* 1:OK, 0:Timeout */
|
||||
BYTE d;
|
||||
UINT tmr;
|
||||
|
||||
|
||||
for (tmr = 5000; tmr; tmr--) { /* Wait for ready in timeout of 500ms */
|
||||
outp(DATAPORT+15, 50);
|
||||
do { /* Wait for ready in timeout of 500ms */
|
||||
d = inp(DATAPORT);
|
||||
if (d == 0xFF) break;
|
||||
dly_us(100);
|
||||
}
|
||||
} while(!inp(DATAPORT+15));
|
||||
|
||||
return tmr ? 1 : 0;
|
||||
return d == 0xFF;
|
||||
}
|
||||
|
||||
|
||||
@@ -310,11 +309,11 @@ int rcvr_datablock ( /* 1:OK, 0:Failed */
|
||||
UINT tmr;
|
||||
|
||||
|
||||
for (tmr = 1000; tmr; tmr--) { /* Wait for data packet in timeout of 100ms */
|
||||
outp(DATAPORT+15, 10);
|
||||
do { /* Wait for data packet in timeout of 100ms */
|
||||
d = inp(DATAPORT);
|
||||
if (d != 0xFF) break;
|
||||
dly_us(100);
|
||||
}
|
||||
} while(!inp(DATAPORT+15));
|
||||
if (d != 0xFE) {
|
||||
return 0; /* If not valid data token, return with error */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user