From 67c86a76d989430dbb87d95d5a0f280e3c3b458f Mon Sep 17 00:00:00 2001 From: Rob Purchase Date: Mon, 22 Jun 2009 18:06:08 +0000 Subject: 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 --- firmware/target/arm/ata-nand-telechips.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'firmware') 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++; -- cgit v1.2.3