diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-06-04 23:15:52 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-06-04 23:15:52 +0000 |
commit | 5690f78fb23ec66aeadf5ecf8200b5610b3e59d2 (patch) | |
tree | 62bab156602ab905851fbb000c22d48bf2f8f85e /firmware | |
parent | c9cc73ec1988dae9e3d1a09347ceac2a4ecc1f67 (diff) |
Multiple choice LED configuration instead of HAVE_LED. Removes erroneous MMC icon display on iriver, and saves some code on Ondio. Removed invert_led() as it is no longer used.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6568 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 2 | ||||
-rw-r--r-- | firmware/drivers/ata.c | 8 | ||||
-rw-r--r-- | firmware/drivers/led.c | 32 | ||||
-rw-r--r-- | firmware/export/ata.h | 2 | ||||
-rw-r--r-- | firmware/export/config-fmrecorder.h | 4 | ||||
-rw-r--r-- | firmware/export/config-gmini120.h | 3 | ||||
-rw-r--r-- | firmware/export/config-gminisp.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ondiofm.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ondiosp.h | 3 | ||||
-rw-r--r-- | firmware/export/config-player.h | 4 | ||||
-rw-r--r-- | firmware/export/config-recorder.h | 4 | ||||
-rw-r--r-- | firmware/export/config-recorderv2.h | 4 | ||||
-rw-r--r-- | firmware/export/config.h | 5 | ||||
-rw-r--r-- | firmware/export/led.h | 3 | ||||
-rw-r--r-- | firmware/panic.c | 4 |
15 files changed, 44 insertions, 40 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 542081b7ca..4bf22ff6e7 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -52,7 +52,9 @@ drivers/lcd-recorder.c #endif #endif drivers/power.c +#ifdef CONFIG_LED drivers/led.c +#endif #ifndef SIMULATOR drivers/adc.c #ifdef HAVE_MMC diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index c8ad3b3151..9bf1815e36 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -241,8 +241,10 @@ static volatile unsigned char* ata_control; bool old_recorder = false; int ata_spinup_time = 0; +#ifdef CONFIG_LED static bool ata_led_enabled = true; static bool ata_led_on = false; +#endif static bool spinup = false; static bool sleeping = true; static long sleep_timeout = 5*HZ; @@ -475,12 +477,16 @@ static void copy_read_sectors(unsigned char* buf, int wordcount) #endif } +#ifdef CONFIG_LED static void ata_led(bool on) { ata_led_on = on; if (ata_led_enabled) { led(ata_led_on); } } +#else +#define ata_led(on) +#endif int ata_read_sectors(IF_MV2(int drive,) unsigned long start, @@ -1468,6 +1474,7 @@ int ata_init(void) return 0; } +#if CONFIG_LED == LED_REAL void ata_set_led_enabled(bool enabled) { ata_led_enabled = enabled; if (ata_led_enabled) { @@ -1476,3 +1483,4 @@ void ata_set_led_enabled(bool enabled) { led(false); } } +#endif diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index 4598175b79..ca4aadac71 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c @@ -23,16 +23,11 @@ #include "system.h" #include "kernel.h" -static bool current; - -#ifdef HAVE_LED - -static bool xor; +#if CONFIG_LED == LED_REAL void led(bool on) { - current = on; - if ( on ^ xor ) + if ( on ) #ifdef GMINI_ARCH P2 |= 1; else @@ -48,21 +43,9 @@ void led(bool on) #endif } -void invert_led(bool on) -{ - if ( on ) - { - xor = 1; - } - else - { - xor = 0; - } - led(current); -} - -#else /* no LED, just status update */ +#elif CONFIG_LED == LED_VIRTUAL +static bool current; static long last_on; /* timestamp of switching off */ void led(bool on) @@ -74,15 +57,10 @@ void led(bool on) current = on; } -void invert_led(bool on) -{ - (void)on; /* no invert feature */ -} - bool led_read(int delayticks) /* read by status bar update */ { /* reading "off" is delayed by user-supplied monoflop value */ return (current || TIME_BEFORE(current_tick, last_on+delayticks)); } -#endif // #ifdef HAVE_LED +#endif /* CONFIG_LED */ diff --git a/firmware/export/ata.h b/firmware/export/ata.h index 2043de915a..e9dc54c6fe 100644 --- a/firmware/export/ata.h +++ b/firmware/export/ata.h @@ -61,7 +61,9 @@ extern int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, extern void ata_delayed_write(unsigned long sector, const void* buf); extern void ata_flush(void); extern void ata_spin(void); +#if CONFIG_LED == LED_REAL extern void ata_set_led_enabled(bool enabled); +#endif extern unsigned short* ata_get_identify(void); extern long last_disk_activity; diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index ec410cb02a..b7f8621f67 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h @@ -67,8 +67,8 @@ /* The start address index for ROM builds */ #define ROM_START 0x14010 -/* Define this for programmable LED available */ -#define HAVE_LED +/* Software controlled LED */ +#define CONFIG_LED LED_REAL /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index 473f1cfa7f..f1c20ee240 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h @@ -54,7 +54,8 @@ #define GMINI_ARCH -#define HAVE_LED +/* Software controlled LED */ +#define CONFIG_LED LED_REAL /* Define this if you have adjustable CPU frequency */ #define HAVE_ADJUSTABLE_CPU_FREQ diff --git a/firmware/export/config-gminisp.h b/firmware/export/config-gminisp.h index 431cf2f3ef..5cf8a76204 100644 --- a/firmware/export/config-gminisp.h +++ b/firmware/export/config-gminisp.h @@ -48,7 +48,8 @@ #define GMINI_ARCH -#define HAVE_LED +/* Software controlled LED */ +#define CONFIG_LED LED_REAL /* Define this if you have adjustable CPU frequency */ #define HAVE_ADJUSTABLE_CPU_FREQ diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index cce88e591b..2380f220c0 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h @@ -85,6 +85,9 @@ /* define this if media can be exchanged on the fly */ #define HAVE_HOTSWAP +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + #define CONFIG_LCD LCD_SSD1815 #define BOOTFILE_EXT ".ajz" diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index 58cb4085ae..66062fa0f3 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h @@ -73,6 +73,9 @@ /* define this if media can be exchanged on the fly */ #define HAVE_HOTSWAP +/* Virtual LED (icon) */ +#define CONFIG_LED LED_VIRTUAL + #define CONFIG_LCD LCD_SSD1815 #define BOOTFILE_EXT ".ajz" diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index 8b85bfdfae..eee9e97530 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -60,8 +60,8 @@ /* The start address index for ROM builds */ #define ROM_START 0xD010 -/* Define this for programmable LED available */ -#define HAVE_LED +/* Software controlled LED */ +#define CONFIG_LED LED_REAL /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index a3a354feea..61c76d480d 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h @@ -61,8 +61,8 @@ /* The start address index for ROM builds */ #define ROM_START 0x11010 -/* Define this for programmable LED available */ -#define HAVE_LED +/* Software controlled LED */ +#define CONFIG_LED LED_REAL /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index b9a011802c..e042a78ead 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h @@ -67,8 +67,8 @@ /* The start address index for ROM builds */ #define ROM_START 0x12010 -/* Define this for programmable LED available */ -#define HAVE_LED +/* Software controlled LED */ +#define CONFIG_LED LED_REAL /* Define this for LCD backlight available */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ diff --git a/firmware/export/config.h b/firmware/export/config.h index 56001e32ad..6faaa49ffa 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -74,6 +74,11 @@ #define I2C_GMINI 2 /* Gmini style */ #define I2C_H100 3 /* iRiver h100 style */ +/* CONFIG_LED */ +#define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */ +#define LED_VIRTUAL 2 /* Virtual LED (icon) (Archos Ondio) */ +/* else HW controlled LED (iRiver H1x0) */ + /* now go and pick yours */ #if defined(ARCHOS_PLAYER) #include "config-player.h" diff --git a/firmware/export/led.h b/firmware/export/led.h index 052da2633b..f1b3b95447 100644 --- a/firmware/export/led.h +++ b/firmware/export/led.h @@ -23,8 +23,7 @@ #include <stdbool.h> extern void led( bool on ); -extern void invert_led( bool on ); -#ifndef HAVE_LED +#if CONFIG_LED == LED_VIRTUAL extern bool led_read(int delayticks); /* read for status bar */ #endif diff --git a/firmware/panic.c b/firmware/panic.c index bc46c82824..37a185f990 100644 --- a/firmware/panic.c +++ b/firmware/panic.c @@ -36,7 +36,9 @@ void panicf( const char *fmt, ...) va_list ap; #ifndef SIMULATOR +#if CONFIG_LED == LED_REAL bool state = false; +#endif /* Disable interrupts */ #if CONFIG_CPU == SH7034 @@ -76,7 +78,7 @@ void panicf( const char *fmt, ...) DEBUGF(panic_buf); while (1) { -#ifndef SIMULATOR +#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) volatile long i; led (state); state = state?false:true; |