logo       
Google Custom Search
    AddThis Social Bookmark Button

cvs: firmware/drivers ata.c,1.51,1.52: msg#00042

Subject: cvs: firmware/drivers ata.c,1.51,1.52
Update of /cvsroot/rockbox/firmware/drivers
In directory usw-pr-cvs1:/tmp/cvs-serv1255/firmware/drivers

Modified Files:
        ata.c 
Log Message:
Added read retry.

Index: ata.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/ata.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- ata.c       23 Sep 2002 11:39:21 -0000      1.51
+++ ata.c       24 Sep 2002 14:23:18 -0000      1.52
@@ -81,6 +81,8 @@
 
 #define Q_SLEEP 0
 
+#define READ_TIMEOUT 5*HZ
+
 static struct mutex ata_mtx;
 char ata_device; /* device 0 (master) or 1 (slave) */
 int ata_io_address; /* 0x300 or 0x200, only valid on recorder */
@@ -166,6 +168,7 @@
                      void* buf)
 {
     int ret = 0;
+    int timeout;
 
     last_disk_activity = current_tick;
 
@@ -196,6 +199,9 @@
 
     led(true);
 
+    timeout = current_tick + READ_TIMEOUT;
+    while (TIME_BEFORE(current_tick, timeout)) {
+
     if ( count == 256 )
         ATA_NSECTOR = 0; /* 0 means 256 sectors */
     else
@@ -212,11 +218,9 @@
         int sectors;
         int wordcount;
 
-        if (!wait_for_start_of_transfer())
-        {
-            led(false);
-            mutex_unlock(&ata_mtx);
-            return -1;
+            if (!wait_for_start_of_transfer()) {
+                ret = -4;
+                continue;
         }
 
         /* if destination address is odd, use byte copying,
@@ -249,9 +253,13 @@
         count -= sectors;
     }
 
-    if(!wait_for_end_of_transfer())
+        if(!wait_for_end_of_transfer()) {
         ret = -3;
+            continue;
+        }
 
+        break;
+    }
     led(false);
 
     mutex_unlock(&ata_mtx);





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>