diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata_mmc.c | 4 | ||||
-rw-r--r-- | firmware/drivers/led.c | 21 | ||||
-rw-r--r-- | firmware/export/led.h | 3 |
3 files changed, 24 insertions, 4 deletions
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,) | |||
635 | addr = start * SECTOR_SIZE; | 635 | addr = start * SECTOR_SIZE; |
636 | 636 | ||
637 | mutex_lock(&mmc_mutex); | 637 | mutex_lock(&mmc_mutex); |
638 | led(true); | ||
638 | #ifdef HAVE_MULTIVOLUME | 639 | #ifdef HAVE_MULTIVOLUME |
639 | card = &card_info[drive]; | 640 | card = &card_info[drive]; |
640 | ret = select_card(drive); | 641 | ret = select_card(drive); |
@@ -681,6 +682,7 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
681 | } | 682 | } |
682 | 683 | ||
683 | deselect_card(); | 684 | deselect_card(); |
685 | led(false); | ||
684 | mutex_unlock(&mmc_mutex); | 686 | mutex_unlock(&mmc_mutex); |
685 | 687 | ||
686 | /* only flush if reading went ok */ | 688 | /* only flush if reading went ok */ |
@@ -706,6 +708,7 @@ int ata_write_sectors(IF_MV2(int drive,) | |||
706 | addr = start * SECTOR_SIZE; | 708 | addr = start * SECTOR_SIZE; |
707 | 709 | ||
708 | mutex_lock(&mmc_mutex); | 710 | mutex_lock(&mmc_mutex); |
711 | led(true); | ||
709 | #ifdef HAVE_MULTIVOLUME | 712 | #ifdef HAVE_MULTIVOLUME |
710 | card = &card_info[drive]; | 713 | card = &card_info[drive]; |
711 | ret = select_card(drive); | 714 | ret = select_card(drive); |
@@ -750,6 +753,7 @@ int ata_write_sectors(IF_MV2(int drive,) | |||
750 | } | 753 | } |
751 | 754 | ||
752 | deselect_card(); | 755 | deselect_card(); |
756 | led(false); | ||
753 | mutex_unlock(&mmc_mutex); | 757 | mutex_unlock(&mmc_mutex); |
754 | 758 | ||
755 | /* only flush if writing went ok */ | 759 | /* 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 @@ | |||
21 | #include "cpu.h" | 21 | #include "cpu.h" |
22 | #include "led.h" | 22 | #include "led.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "kernel.h" | ||
25 | |||
26 | static bool current; | ||
24 | 27 | ||
25 | #ifdef HAVE_LED | 28 | #ifdef HAVE_LED |
26 | 29 | ||
27 | static bool xor; | 30 | static bool xor; |
28 | static bool current; | ||
29 | 31 | ||
30 | void led(bool on) | 32 | void led(bool on) |
31 | { | 33 | { |
@@ -59,16 +61,27 @@ void invert_led(bool on) | |||
59 | led(current); | 61 | led(current); |
60 | } | 62 | } |
61 | 63 | ||
62 | #else /* no LED, just dummies */ | 64 | #else /* no LED, just status update */ |
65 | |||
66 | static long delay; | ||
63 | 67 | ||
64 | void led(bool on) | 68 | void led(bool on) |
65 | { | 69 | { |
66 | (void)on; | 70 | if (current && !on) /* switching off */ |
71 | { | ||
72 | delay = current_tick + HZ/2; /* delay the "off" status a bit */ | ||
73 | } | ||
74 | current = on; | ||
67 | } | 75 | } |
68 | 76 | ||
69 | void invert_led(bool on) | 77 | void invert_led(bool on) |
70 | { | 78 | { |
71 | (void)on; | 79 | (void)on; /* no invert feature */ |
80 | } | ||
81 | |||
82 | bool led_read(void) /* read by status bar update */ | ||
83 | { | ||
84 | return (current || TIME_BEFORE(current_tick, delay)); | ||
72 | } | 85 | } |
73 | 86 | ||
74 | #endif // #ifdef HAVE_LED | 87 | #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 @@ | |||
24 | 24 | ||
25 | extern void led( bool on ); | 25 | extern void led( bool on ); |
26 | extern void invert_led( bool on ); | 26 | extern void invert_led( bool on ); |
27 | #ifndef HAVE_LED | ||
28 | extern bool led_read(void); /* read for status bar */ | ||
29 | #endif | ||
27 | 30 | ||
28 | #endif | 31 | #endif |