X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FStorage%2FFDD%2Ffdd.c;h=cbd7844feb668900e042aca7801af14bb59b46e3;hb=9d85201216cb35e1b1e051b1d7cdc38eaa5befa4;hp=bd117e1d29153b90cdf7c2ab66b7d2f0abf2067e;hpb=635bc78017d8a4a16314a973e39c849b2afac795;p=tpg%2Facess2.git diff --git a/Modules/Storage/FDD/fdd.c b/Modules/Storage/FDD/fdd.c index bd117e1d..cbd7844f 100644 --- a/Modules/Storage/FDD/fdd.c +++ b/Modules/Storage/FDD/fdd.c @@ -676,22 +676,19 @@ void FDD_SensInt(int base, Uint8 *sr0, Uint8 *cyl) */ void FDD_int_SendByte(int base, char byte) { - volatile int state; - int timeout = 128; - for( ; timeout--; ) + int timeout = 128; + + while( (inb(base + PORT_MAINSTATUS) & 0xC0) != 0x80 && timeout-- ) + inb(0x80); //Delay + + if( timeout >= 0 ) { - state = inb(base + PORT_MAINSTATUS); - if ((state & 0xC0) == 0x80) - { - outb(base + PORT_DATA, byte); - return; - } - inb(0x80); //Delay + outb(base + PORT_DATA, byte); + } + else + { + Log_Warning("FDD", "FDD_int_SendByte: Timeout sending byte 0x%x to base 0x%x\n", byte, base); } - - #if WARN - Warning("FDD_int_SendByte - Timeout sending byte 0x%x to base 0x%x\n", byte, base); - #endif } /** @@ -700,16 +697,20 @@ void FDD_int_SendByte(int base, char byte) */ int FDD_int_GetByte(int base) { - volatile int state; - int timeout; - for( timeout = 128; timeout--; ) + int timeout = 128; + + while( (inb(base + PORT_MAINSTATUS) & 0xd0) != 0xd0 && timeout-- ) + inb(0x80); //Delay + + if( timeout >= 0 ) { - state = inb((base + PORT_MAINSTATUS)); - if ((state & 0xd0) == 0xd0) - return inb(base + PORT_DATA); - inb(0x80); + return inb(base + PORT_DATA); + } + else + { + Log_Warning("FDD", "FDD_int_GetByte: Timeout reading byte from base 0x%x\n", base); + return -1; } - return -1; } /**