summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/sdmmc-imx233.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-10-10 17:54:33 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2012-10-10 17:54:33 +0200
commite3e53c965a39b5b3108ffa46369d233d6a2f1ff6 (patch)
tree45813ea4b31821be345c368b14b1a32e6b290b67 /firmware/target/arm/imx233/sdmmc-imx233.c
parent097352a3ecf608f0934e1628c6b3cb783cf65b6c (diff)
downloadrockbox-e3e53c965a39b5b3108ffa46369d233d6a2f1ff6.tar.gz
rockbox-e3e53c965a39b5b3108ffa46369d233d6a2f1ff6.tar.bz2
rockbox-e3e53c965a39b5b3108ffa46369d233d6a2f1ff6.zip
imx233/fuze+: add status led(icon) support to sd/mmc storage layer
Change-Id: I9c0e1ecd04d1935825606e906e6a434a3afb2175
Diffstat (limited to 'firmware/target/arm/imx233/sdmmc-imx233.c')
-rw-r--r--firmware/target/arm/imx233/sdmmc-imx233.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c
index e0966f784b..32d0013574 100644
--- a/firmware/target/arm/imx233/sdmmc-imx233.c
+++ b/firmware/target/arm/imx233/sdmmc-imx233.c
@@ -33,6 +33,7 @@
#include "debug.h"
#include "string.h"
#include "ata_idle_notify.h"
+#include "led.h"
/** NOTE For convenience, this drivers relies on the many similar commands
* between SD and MMC. The following assumptions are made:
@@ -501,6 +502,13 @@ static int __xfer_sectors(int drive, unsigned long start, int count, void *buf,
return ret;
}
+static void do_led(int delta)
+{
+ static int level = 0;
+ level += delta;
+ led(level > 0);
+}
+
static int transfer_sectors(int drive, unsigned long start, int count, void *buf, bool read)
{
int ret = 0;
@@ -511,6 +519,9 @@ static int transfer_sectors(int drive, unsigned long start, int count, void *buf
/* lock per-drive mutex */
mutex_lock(&mutex[drive]);
+ /* update led status */
+ do_led(1);
+
/* for SD cards, init if necessary */
#if CONFIG_STORAGE & STORAGE_SD
if(SDMMC_MODE(drive) == SD_MODE && SDMMC_INFO(drive).initialized <= 0)
@@ -604,6 +615,8 @@ static int transfer_sectors(int drive, unsigned long start, int count, void *buf
if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_NO_RESP, NULL))
ret = -23;
Lend:
+ /* update led status */
+ do_led(-1);
/* release per-drive mutex */
mutex_unlock(&mutex[drive]);
return ret;