Make the TCC NAND driver use the (virtual) disk activity LED.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21748 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rob Purchase 2009-07-10 16:55:18 +00:00
parent 99edc7b075
commit 9cb62038e3

View file

@ -27,6 +27,7 @@
#include "nand_id.h" #include "nand_id.h"
#include "storage.h" #include "storage.h"
#include "buffer.h" #include "buffer.h"
#include "led.h"
#define SECTOR_SIZE 512 #define SECTOR_SIZE 512
@ -701,7 +702,12 @@ int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
#ifdef HAVE_MULTIVOLUME #ifdef HAVE_MULTIVOLUME
(void)drive; /* unused for now */ (void)drive; /* unused for now */
#endif #endif
int ret = 0;
mutex_lock(&ata_mtx); mutex_lock(&ata_mtx);
led(true);
while (incount > 0) while (incount > 0)
{ {
@ -713,8 +719,8 @@ int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
{ {
if (!nand_read_sector_of_logical_segment(segment, secmod, inbuf)) if (!nand_read_sector_of_logical_segment(segment, secmod, inbuf))
{ {
mutex_unlock(&ata_mtx); ret = -1;
return -1; goto nand_read_error;
} }
#ifdef CPU_TCC780X /* 77x doesn't have USEC_TIMER yet */ #ifdef CPU_TCC780X /* 77x doesn't have USEC_TIMER yet */
@ -733,14 +739,18 @@ int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int incount,
if (done < 0) if (done < 0)
{ {
mutex_unlock(&ata_mtx); ret = -1;
return -1; goto nand_read_error;
} }
start += done; start += done;
} }
nand_read_error:
mutex_unlock(&ata_mtx); mutex_unlock(&ata_mtx);
return 0; led(false);
return ret;
} }