From c76fbf7162e598895b1308f1855b0f70629968fc Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Sat, 19 Feb 2005 00:34:15 +0000 Subject: Ondio: disk indication in the status bar, to compensate for lacking LED git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6012 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata_mmc.c | 4 ++++ firmware/drivers/led.c | 21 +++++++++++++++++---- firmware/export/led.h | 3 +++ 3 files changed, 24 insertions(+), 4 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 7ba6dac296..7139f0394f 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c @@ -635,6 +635,7 @@ int ata_read_sectors(IF_MV2(int drive,) addr = start * SECTOR_SIZE; mutex_lock(&mmc_mutex); + led(true); #ifdef HAVE_MULTIVOLUME card = &card_info[drive]; ret = select_card(drive); @@ -681,6 +682,7 @@ int ata_read_sectors(IF_MV2(int drive,) } deselect_card(); + led(false); mutex_unlock(&mmc_mutex); /* only flush if reading went ok */ @@ -706,6 +708,7 @@ int ata_write_sectors(IF_MV2(int drive,) addr = start * SECTOR_SIZE; mutex_lock(&mmc_mutex); + led(true); #ifdef HAVE_MULTIVOLUME card = &card_info[drive]; ret = select_card(drive); @@ -750,6 +753,7 @@ int ata_write_sectors(IF_MV2(int drive,) } deselect_card(); + led(false); mutex_unlock(&mmc_mutex); /* only flush if writing went ok */ diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index 90a1b2cb39..4b63d07582 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c @@ -21,11 +21,13 @@ #include "cpu.h" #include "led.h" #include "system.h" +#include "kernel.h" + +static bool current; #ifdef HAVE_LED static bool xor; -static bool current; void led(bool on) { @@ -59,16 +61,27 @@ void invert_led(bool on) led(current); } -#else /* no LED, just dummies */ +#else /* no LED, just status update */ + +static long delay; void led(bool on) { - (void)on; + if (current && !on) /* switching off */ + { + delay = current_tick + HZ/2; /* delay the "off" status a bit */ + } + current = on; } void invert_led(bool on) { - (void)on; + (void)on; /* no invert feature */ +} + +bool led_read(void) /* read by status bar update */ +{ + return (current || TIME_BEFORE(current_tick, delay)); } #endif // #ifdef HAVE_LED diff --git a/firmware/export/led.h b/firmware/export/led.h index cc035b9345..d7322e465b 100644 --- a/firmware/export/led.h +++ b/firmware/export/led.h @@ -24,5 +24,8 @@ extern void led( bool on ); extern void invert_led( bool on ); +#ifndef HAVE_LED +extern bool led_read(void); /* read for status bar */ +#endif #endif -- cgit v1.2.3