Added some very pedantic warning flags
[tpg/acess2.git] / Modules / Storage / FDD / fdd.c
index 4a9ec2d..cbd7844 100644 (file)
@@ -69,7 +69,7 @@ enum FloppyPorts {
 
 enum FloppyCommands {
        FIX_DRIVE_DATA  = 0x03,
-       HECK_DRIVE_STATUS       = 0x04,
+       CHECK_DRIVE_STATUS      = 0x04,
        CALIBRATE_DRIVE = 0x07,
        CHECK_INTERRUPT_STATUS = 0x08,
        SEEK_TRACK              = 0x0F,
@@ -213,7 +213,7 @@ int FDD_Install(char **Arguments)
 void FDD_UnloadModule()
 {
         int    i;
-       //DevFS_DelDevice( &gFDD_DriverInfo );
+       DevFS_DelDevice( &gFDD_DriverInfo );
        Mutex_Acquire(&glFDD);
        for(i=0;i<4;i++) {
                Time_RemoveTimer(gFDD_Devices[i].timer);
@@ -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;
 }
 
 /**

UCC git Repository :: git.ucc.asn.au