Fixed poor timeout code in out_fdc. The timeout counter was not being

reinitialized between while loops.  Added comments about what was going
on in the out_fdc routine.

out_fdc now returns if the direction bit is not set in time instead of
trying to wait for MRQ to get cleared.
This commit is contained in:
Rodney W. Grimes 1993-08-12 09:21:20 +00:00
parent 70ce04ee23
commit 3b3837db61
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285
3 changed files with 57 additions and 12 deletions

View File

@ -46,12 +46,19 @@
* Largely rewritten to handle multiple controllers and drives
* By Julian Elischer, Sun Apr 4 16:34:33 WST 1993
*/
char rev[] = "$Revision: 1.1.1.1 $";
char rev[] = "$Revision: 1.2 $";
/*
* $Header: /a/cvs/386BSD/src/sys.386bsd/i386/isa/fd.c,v 1.1.1.1 1993/06/12 14:58:02 rgrimes Exp $
* $Header: /freefall/a/cvs/386BSD/src/sys/i386/isa/fd.c,v 1.2 1993/07/15 17:53:04 davidg Exp $
*/
/*
* $Log: fd.c,v $
* Revision 1.2 1993/07/15 17:53:04 davidg
* Modified attach printf's so that the output is compatible with the "new"
* way of doing things. There still remain several drivers that need to
* be updated. Also added a compile-time option to pccons to switch the
* control and caps-lock keys (REVERSE_CAPS_CTRL) - added for my personal
* sanity.
*
* Revision 1.1.1.1 1993/06/12 14:58:02 rgrimes
* Initial import, 0.1 + pk 0.2.4-B1
*
@ -483,11 +490,19 @@ in_fdc(fdcu_t fdcu)
out_fdc(fdcu_t fdcu,int x)
{
int baseport = fdc_data[fdcu].baseport;
int i = 100000;
int i;
/* Check that the direction bit is set */
i = 100000;
while ((inb(baseport+fdsts) & NE7_DIO) && i-- > 0);
if (i <= 0) return (-1); /* Floppy timed out */
/* Check that the floppy controller is ready for a command */
i = 100000;
while ((inb(baseport+fdsts) & NE7_RQM) == 0 && i-- > 0);
if (i <= 0) return (-1);
if (i <= 0) return (-1); /* Floppy timed out */
/* Send the command and return */
outb(baseport+fddata,x);
TRACE1("[0x%x->fddata]",x);
return (0);

View File

@ -46,12 +46,19 @@
* Largely rewritten to handle multiple controllers and drives
* By Julian Elischer, Sun Apr 4 16:34:33 WST 1993
*/
char rev[] = "$Revision: 1.1.1.1 $";
char rev[] = "$Revision: 1.2 $";
/*
* $Header: /a/cvs/386BSD/src/sys.386bsd/i386/isa/fd.c,v 1.1.1.1 1993/06/12 14:58:02 rgrimes Exp $
* $Header: /freefall/a/cvs/386BSD/src/sys/i386/isa/fd.c,v 1.2 1993/07/15 17:53:04 davidg Exp $
*/
/*
* $Log: fd.c,v $
* Revision 1.2 1993/07/15 17:53:04 davidg
* Modified attach printf's so that the output is compatible with the "new"
* way of doing things. There still remain several drivers that need to
* be updated. Also added a compile-time option to pccons to switch the
* control and caps-lock keys (REVERSE_CAPS_CTRL) - added for my personal
* sanity.
*
* Revision 1.1.1.1 1993/06/12 14:58:02 rgrimes
* Initial import, 0.1 + pk 0.2.4-B1
*
@ -483,11 +490,19 @@ in_fdc(fdcu_t fdcu)
out_fdc(fdcu_t fdcu,int x)
{
int baseport = fdc_data[fdcu].baseport;
int i = 100000;
int i;
/* Check that the direction bit is set */
i = 100000;
while ((inb(baseport+fdsts) & NE7_DIO) && i-- > 0);
if (i <= 0) return (-1); /* Floppy timed out */
/* Check that the floppy controller is ready for a command */
i = 100000;
while ((inb(baseport+fdsts) & NE7_RQM) == 0 && i-- > 0);
if (i <= 0) return (-1);
if (i <= 0) return (-1); /* Floppy timed out */
/* Send the command and return */
outb(baseport+fddata,x);
TRACE1("[0x%x->fddata]",x);
return (0);

View File

@ -46,12 +46,19 @@
* Largely rewritten to handle multiple controllers and drives
* By Julian Elischer, Sun Apr 4 16:34:33 WST 1993
*/
char rev[] = "$Revision: 1.1.1.1 $";
char rev[] = "$Revision: 1.2 $";
/*
* $Header: /a/cvs/386BSD/src/sys.386bsd/i386/isa/fd.c,v 1.1.1.1 1993/06/12 14:58:02 rgrimes Exp $
* $Header: /freefall/a/cvs/386BSD/src/sys/i386/isa/fd.c,v 1.2 1993/07/15 17:53:04 davidg Exp $
*/
/*
* $Log: fd.c,v $
* Revision 1.2 1993/07/15 17:53:04 davidg
* Modified attach printf's so that the output is compatible with the "new"
* way of doing things. There still remain several drivers that need to
* be updated. Also added a compile-time option to pccons to switch the
* control and caps-lock keys (REVERSE_CAPS_CTRL) - added for my personal
* sanity.
*
* Revision 1.1.1.1 1993/06/12 14:58:02 rgrimes
* Initial import, 0.1 + pk 0.2.4-B1
*
@ -483,11 +490,19 @@ in_fdc(fdcu_t fdcu)
out_fdc(fdcu_t fdcu,int x)
{
int baseport = fdc_data[fdcu].baseport;
int i = 100000;
int i;
/* Check that the direction bit is set */
i = 100000;
while ((inb(baseport+fdsts) & NE7_DIO) && i-- > 0);
if (i <= 0) return (-1); /* Floppy timed out */
/* Check that the floppy controller is ready for a command */
i = 100000;
while ((inb(baseport+fdsts) & NE7_RQM) == 0 && i-- > 0);
if (i <= 0) return (-1);
if (i <= 0) return (-1); /* Floppy timed out */
/* Send the command and return */
outb(baseport+fddata,x);
TRACE1("[0x%x->fddata]",x);
return (0);