freemyipod r316 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r315‎ | r316 | r317 >
Date:23:38, 3 December 2010
Author:theseven
Status:new
Tags:
Comment:
emBIOS: Fix ipodclassic ATA driver
Modified paths:
  • /embios/trunk/target/ipodclassic/storage_ata.c (modified) (history)

Diff [purge]

Index: embios/trunk/target/ipodclassic/storage_ata.c
@@ -238,7 +238,7 @@
239239 ATA_COMMAND = BIT(1);
240240 while (count)
241241 {
242 - uint32_t cnt = MIN(64, count);
 242+ uint32_t cnt = MIN(32, count);
243243 PASS_RC(ata_wait_for_rdy(100000), 2, 0);
244244 ata_write_cbr(&ATA_PIO_DVR, 0);
245245 if (ata_lba48)
@@ -269,6 +269,7 @@
270270 count -= cnt;
271271 if (ata_dma)
272272 {
 273+ PASS_RC(ata_wait_for_start_of_transfer(10000000), 2, 1);
273274 if (write)
274275 {
275276 ATA_SBUF_START = buffer;
@@ -288,7 +289,7 @@
289290 ATA_IRQ = BITRANGE(0, 4);
290291 ATA_IRQ_MASK = BIT(0);
291292 ATA_COMMAND = BIT(0);
292 - if (wakeup_wait(&ata_wakeup, 3000000) == THREAD_TIMEOUT)
 293+ if (wakeup_wait(&ata_wakeup, 10000000) == THREAD_TIMEOUT)
293294 {
294295 ATA_COMMAND = BIT(1);
295296 ATA_CFG &= ~(BITRANGE(2, 3) | BIT(12));
@@ -304,7 +305,7 @@
305306 while (cnt--)
306307 {
307308 int i;
308 - PASS_RC(ata_wait_for_start_of_transfer(3000000), 2, 1);
 309+ PASS_RC(ata_wait_for_start_of_transfer(10000000), 2, 1);
309310 if (write)
310311 for (i = 0; i < 256; i++)
311312 ata_write_cbr(&ATA_PIO_DTR, ((uint16_t*)buffer)[i]);
@@ -350,7 +351,7 @@
351352 void* inbuf)
352353 {
353354 mutex_lock(&ata_mutex, TIMEOUT_BLOCK);
354 - int tries = 5;
 355+ int tries = 3;
355356 int rc = -1;
356357 while (--tries && rc)
357358 {
@@ -365,7 +366,7 @@
366367 const void* outbuf)
367368 {
368369 mutex_lock(&ata_mutex, TIMEOUT_BLOCK);
369 - int tries = 5;
 370+ int tries = 3;
370371 int rc = -1;
371372 while (--tries && rc)
372373 {