summaryrefslogtreecommitdiffstats
path: root/firmware/target
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2009-06-22 18:06:08 +0000
committerRob Purchase <shotofadds@rockbox.org>2009-06-22 18:06:08 +0000
commit67c86a76d989430dbb87d95d5a0f280e3c3b458f (patch)
tree17b24500680e1e9f7093bf02b65f20978d735599 /firmware/target
parent4b831753e799f969b473b0b0fb48317722d7b98e (diff)
downloadrockbox-67c86a76d989430dbb87d95d5a0f280e3c3b458f.tar.gz
rockbox-67c86a76d989430dbb87d95d5a0f280e3c3b458f.zip
TCC78x: Make the NAND driver yield during reads (thanks to bertrik for spotting the obvious error that caused this to crash until now). Fixes the D2 'delay before playback starts' bug.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21465 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/ata-nand-telechips.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/firmware/target/arm/ata-nand-telechips.c b/firmware/target/arm/ata-nand-telechips.c
index 5401f0d3ab..ceabf96169 100644
--- a/firmware/target/arm/ata-nand-telechips.c
+++ b/firmware/target/arm/ata-nand-telechips.c
@@ -40,6 +40,9 @@ long last_disk_activity = -1;
/** static, private data **/
static bool initialized = false;
+static long next_yield = 0;
+#define MIN_YIELD_PERIOD 1000
+
static struct mutex ata_mtx SHAREDBSS_ATTR;
#if defined(COWON_D2) || defined(IAUDIO_7)
@@ -714,6 +717,14 @@ int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
return -1;
}
+#ifdef CPU_TCC780X /* 77x doesn't have USEC_TIMER yet */
+ if (TIME_AFTER(USEC_TIMER, next_yield))
+ {
+ next_yield = USEC_TIMER + MIN_YIELD_PERIOD;
+ yield();
+ }
+#endif
+
inbuf += SECTOR_SIZE;
incount--;
secmod++;