summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-24 00:10:14 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-24 00:10:14 +0000
commit548755adf12390c533a6b393d6324eb5b9473672 (patch)
treebfa629d7f678193cf9356490d512764c504c044a /firmware
parent33289d090ff46627032291e89672f1846a6d4eb9 (diff)
downloadrockbox-548755adf12390c533a6b393d6324eb5b9473672.tar.gz
rockbox-548755adf12390c533a6b393d6324eb5b9473672.zip
Fixed disk icon display in remote status bar on iriver. * Rolled back led.c changes, introducing a changed #if condition only. Reduces code size on targets with real controllable LED.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8059 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c6
-rw-r--r--firmware/drivers/led.c60
2 files changed, 34 insertions, 32 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index a3dd8be241..ec4b342beb 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -512,7 +512,9 @@ static void copy_read_sectors(unsigned char* buf, int wordcount)
512#endif 512#endif
513} 513}
514 514
515#ifdef CONFIG_LED 515#if CONFIG_LED == LED_REAL
516/* Conditionally block LED access for the ATA driver, so the LED can be
517 * (mis)used for other purposes */
516static void ata_led(bool on) { 518static void ata_led(bool on) {
517 ata_led_on = on; 519 ata_led_on = on;
518 if (ata_led_enabled) { 520 if (ata_led_enabled) {
@@ -520,7 +522,7 @@ static void ata_led(bool on) {
520 } 522 }
521} 523}
522#else 524#else
523#define ata_led(on) 525#define ata_led(on) led(on)
524#endif 526#endif
525 527
526int ata_read_sectors(IF_MV2(int drive,) 528int ata_read_sectors(IF_MV2(int drive,)
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c
index 1e38fa63d3..118911a746 100644
--- a/firmware/drivers/led.c
+++ b/firmware/drivers/led.c
@@ -23,50 +23,50 @@
23#include "system.h" 23#include "system.h"
24#include "kernel.h" 24#include "kernel.h"
25 25
26static bool disk_led_status;
27static long last_on; /* timestamp of switching off */
28
29
30
31void disk_led_on(void)
32{
33 disk_led_status=true;
34#if CONFIG_LED == LED_REAL 26#if CONFIG_LED == LED_REAL
35#ifdef GMINI_ARCH
36 P2 |= 1;
37#else
38 or_b(0x40, &PBDRL);
39#endif
40#endif
41}
42 27
43void disk_led_off(void) 28void led(bool on)
44{ 29{
45 if(disk_led_status) 30 if ( on )
46 {
47 last_on = current_tick;/* remember for off delay */
48 disk_led_status=false;
49#if CONFIG_LED == LED_REAL
50#ifdef GMINI_ARCH 31#ifdef GMINI_ARCH
32 P2 |= 1;
33 else
51 P2 &= ~1; 34 P2 &= ~1;
52#else 35#else
36 {
37 or_b(0x40, &PBDRL);
38 }
39 else
40 {
53 and_b(~0x40, &PBDRL); 41 and_b(~0x40, &PBDRL);
54#endif
55#endif
56 } 42 }
43#endif
57} 44}
58 45
46#elif (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
47
48static bool current;
49static long last_on; /* timestamp of switching off */
50
59void led(bool on) 51void led(bool on)
60{ 52{
61 if ( on ) 53 if (current && !on) /* switching off */
62 disk_led_on(); 54 {
63 else 55 last_on = current_tick; /* remember for off delay */
64 disk_led_off(); 56 }
57 current = on;
65} 58}
66 59
67bool led_read(int delayticks) 60bool led_read(int delayticks) /* read by status bar update */
68{ 61{
69 /* reading "off" is delayed by user-supplied monoflop value */ 62 /* reading "off" is delayed by user-supplied monoflop value */
70 return (disk_led_status || 63 return (current || TIME_BEFORE(current_tick, last_on+delayticks));
71 TIME_BEFORE(current_tick, last_on+delayticks)); 64}
65
66#else
67
68void led(bool on)
69{
70 (void)on;
72} 71}
72#endif /* CONFIG_LED, HAVE_REMOTE_LCD */