|
Lines 424-436
Link Here
|
| 424 |
return fdc_err(fdc, "Enable FIFO failed\n"); |
424 |
return fdc_err(fdc, "Enable FIFO failed\n"); |
| 425 |
|
425 |
|
| 426 |
/* If command is invalid, return */ |
426 |
/* If command is invalid, return */ |
| 427 |
j = 100000; |
427 |
j = FDSTS_TIMEOUT; |
| 428 |
while ((i = fdsts_rd(fdc) & (NE7_DIO | NE7_RQM)) |
428 |
while ((i = fdsts_rd(fdc) & (NE7_DIO | NE7_RQM)) |
| 429 |
!= NE7_RQM && j-- > 0) |
429 |
!= NE7_RQM && j-- > 0) { |
| 430 |
if (i == (NE7_DIO | NE7_RQM)) { |
430 |
if (i == (NE7_DIO | NE7_RQM)) { |
| 431 |
fdc_reset(fdc); |
431 |
fdc_reset(fdc); |
| 432 |
return FD_FAILED; |
432 |
return FD_FAILED; |
| 433 |
} |
433 |
} |
|
|
434 |
DELAY(1); |
| 435 |
} |
| 434 |
if (j<0 || |
436 |
if (j<0 || |
| 435 |
fd_cmd(fdc, 3, |
437 |
fd_cmd(fdc, 3, |
| 436 |
0, (fifo_threshold - 1) & 0xf, 0, 0) < 0) { |
438 |
0, (fifo_threshold - 1) & 0xf, 0, 0) < 0) { |
|
Lines 1296-1306
Link Here
|
| 1296 |
int |
1298 |
int |
| 1297 |
in_fdc(struct fdc_data *fdc) |
1299 |
in_fdc(struct fdc_data *fdc) |
| 1298 |
{ |
1300 |
{ |
| 1299 |
int i, j = 100000; |
1301 |
int i, j = FDSTS_TIMEOUT; |
| 1300 |
while ((i = fdsts_rd(fdc) & (NE7_DIO|NE7_RQM)) |
1302 |
while ((i = fdsts_rd(fdc) & (NE7_DIO|NE7_RQM)) |
| 1301 |
!= (NE7_DIO|NE7_RQM) && j-- > 0) |
1303 |
!= (NE7_DIO|NE7_RQM) && j-- > 0) { |
| 1302 |
if (i == NE7_RQM) |
1304 |
if (i == NE7_RQM) |
| 1303 |
return fdc_err(fdc, "ready for output in input\n"); |
1305 |
return fdc_err(fdc, "ready for output in input\n"); |
|
|
1306 |
DELAY(1); |
| 1307 |
} |
| 1304 |
if (j <= 0) |
1308 |
if (j <= 0) |
| 1305 |
return fdc_err(fdc, bootverbose? "input ready timeout\n": 0); |
1309 |
return fdc_err(fdc, bootverbose? "input ready timeout\n": 0); |
| 1306 |
#ifdef FDC_DEBUG |
1310 |
#ifdef FDC_DEBUG |
|
Lines 1318-1328
Link Here
|
| 1318 |
static int |
1322 |
static int |
| 1319 |
fd_in(struct fdc_data *fdc, int *ptr) |
1323 |
fd_in(struct fdc_data *fdc, int *ptr) |
| 1320 |
{ |
1324 |
{ |
| 1321 |
int i, j = 100000; |
1325 |
int i, j = FDSTS_TIMEOUT; |
| 1322 |
while ((i = fdsts_rd(fdc) & (NE7_DIO|NE7_RQM)) |
1326 |
while ((i = fdsts_rd(fdc) & (NE7_DIO|NE7_RQM)) |
| 1323 |
!= (NE7_DIO|NE7_RQM) && j-- > 0) |
1327 |
!= (NE7_DIO|NE7_RQM) && j-- > 0) { |
| 1324 |
if (i == NE7_RQM) |
1328 |
if (i == NE7_RQM) |
| 1325 |
return fdc_err(fdc, "ready for output in input\n"); |
1329 |
return fdc_err(fdc, "ready for output in input\n"); |
|
|
1330 |
DELAY(1); |
| 1331 |
} |
| 1326 |
if (j <= 0) |
1332 |
if (j <= 0) |
| 1327 |
return fdc_err(fdc, bootverbose? "input ready timeout\n": 0); |
1333 |
return fdc_err(fdc, bootverbose? "input ready timeout\n": 0); |
| 1328 |
#ifdef FDC_DEBUG |
1334 |
#ifdef FDC_DEBUG |
|
Lines 1344-1356
Link Here
|
| 1344 |
int i; |
1350 |
int i; |
| 1345 |
|
1351 |
|
| 1346 |
/* Check that the direction bit is set */ |
1352 |
/* Check that the direction bit is set */ |
| 1347 |
i = 100000; |
1353 |
i = FDSTS_TIMEOUT; |
| 1348 |
while ((fdsts_rd(fdc) & NE7_DIO) && i-- > 0); |
1354 |
while ((fdsts_rd(fdc) & NE7_DIO) && i-- > 0) |
|
|
1355 |
DELAY(1); |
| 1349 |
if (i <= 0) return fdc_err(fdc, "direction bit not set\n"); |
1356 |
if (i <= 0) return fdc_err(fdc, "direction bit not set\n"); |
| 1350 |
|
1357 |
|
| 1351 |
/* Check that the floppy controller is ready for a command */ |
1358 |
/* Check that the floppy controller is ready for a command */ |
| 1352 |
i = 100000; |
1359 |
i = FDSTS_TIMEOUT; |
| 1353 |
while ((fdsts_rd(fdc) & NE7_RQM) == 0 && i-- > 0); |
1360 |
while ((fdsts_rd(fdc) & NE7_RQM) == 0 && i-- > 0) |
|
|
1361 |
DELAY(1); |
| 1354 |
if (i <= 0) |
1362 |
if (i <= 0) |
| 1355 |
return fdc_err(fdc, bootverbose? "output ready timeout\n": 0); |
1363 |
return fdc_err(fdc, bootverbose? "output ready timeout\n": 0); |
| 1356 |
|
1364 |
|