summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-06-04 23:15:52 +0000
committerJens Arnold <amiconn@rockbox.org>2005-06-04 23:15:52 +0000
commit5690f78fb23ec66aeadf5ecf8200b5610b3e59d2 (patch)
tree62bab156602ab905851fbb000c22d48bf2f8f85e
parentc9cc73ec1988dae9e3d1a09347ceac2a4ecc1f67 (diff)
downloadrockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.zip
rockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.tar.gz
rockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.tar.bz2
rockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.tar.xz
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
-rw-r--r--apps/main.c4
-rw-r--r--apps/recorder/icons.c4
-rw-r--r--apps/recorder/icons.h4
-rw-r--r--apps/recorder/recording.c16
-rw-r--r--apps/status.c6
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/drivers/ata.c8
-rw-r--r--firmware/drivers/led.c32
-rw-r--r--firmware/export/ata.h2
-rw-r--r--firmware/export/config-fmrecorder.h4
-rw-r--r--firmware/export/config-gmini120.h3
-rw-r--r--firmware/export/config-gminisp.h3
-rw-r--r--firmware/export/config-ondiofm.h3
-rw-r--r--firmware/export/config-ondiosp.h3
-rw-r--r--firmware/export/config-player.h4
-rw-r--r--firmware/export/config-recorder.h4
-rw-r--r--firmware/export/config-recorderv2.h4
-rw-r--r--firmware/export/config.h5
-rw-r--r--firmware/export/led.h3
-rw-r--r--firmware/panic.c4
20 files changed, 62 insertions, 56 deletions
diff --git a/apps/main.c b/apps/main.c
index 537c3da..5a47e72 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -277,7 +277,7 @@ void init(void)
#ifdef AUTOROCK
if (!usb_detect())
- {
+ {
int fd;
static const char filename[] = PLUGIN_DIR "/autostart.rock";
@@ -303,8 +303,10 @@ int main(void)
app_main();
while(1) {
+#if CONFIG_LED == LED_REAL
led(true); sleep(HZ/10);
led(false); sleep(HZ/10);
+#endif
}
return 0;
}
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 26e494e..ee8c69a 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -74,7 +74,7 @@ const unsigned char bitmap_icons_7x8[][7] =
{0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */
};
-#ifndef HAVE_LED
+#if CONFIG_LED == LED_VIRTUAL
/* Disk/MMC activity */
const unsigned char bitmap_icon_disk[12] =
{0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f};
@@ -405,7 +405,7 @@ void statusbar_icon_lock(void)
STATUSBAR_Y_POS, 5, 8, false);
}
-#ifndef HAVE_LED
+#if CONFIG_LED == LED_VIRTUAL
/*
* no real LED: disk activity in status bar
*/
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index d9d743a..48e9a16 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -63,7 +63,7 @@ enum icons_7x8 {
extern const unsigned char bitmap_icons_5x8[1][5];
extern const unsigned char bitmap_icons_6x8[LastIcon][6];
extern const unsigned char bitmap_icons_7x8[Icon_Last][7];
-#ifndef HAVE_LED
+#if CONFIG_LED == LED_VIRTUAL
extern const unsigned char bitmap_icon_disk[];
#endif
@@ -106,7 +106,7 @@ extern void statusbar_icon_lock(void);
#ifdef HAVE_RTC
extern void statusbar_time(int hour, int minute);
#endif
-#ifndef HAVE_LED
+#if CONFIG_LED == LED_VIRTUAL
extern void statusbar_led(void);
#endif
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 111995c..84c90d2 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -307,7 +307,7 @@ bool recording_screen(void)
char path_buffer[MAX_PATH];
bool been_in_usb_mode = false;
int last_audio_stat = -1;
-#ifdef HAVE_LED
+#if CONFIG_LED == LED_REAL
bool led_state = false;
int led_countdown = 2;
#endif
@@ -320,7 +320,7 @@ bool recording_screen(void)
};
cursor = 0;
-#if defined(HAVE_LED) && !defined(SIMULATOR)
+#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(false);
#endif
mpeg_init_recording();
@@ -356,7 +356,7 @@ bool recording_screen(void)
while(!done)
{
int audio_stat = audio_status();
-#ifdef HAVE_LED
+#if CONFIG_LED == LED_REAL
/*
* Flash the LED while waiting to record. Turn it on while
@@ -401,7 +401,7 @@ bool recording_screen(void)
led(false);
}
}
-#endif /* HAVE_LED */
+#endif /* CONFIG_LED */
/* Wait for a button a while (HZ/10) drawing the peak meter */
button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h);
@@ -574,7 +574,7 @@ bool recording_screen(void)
case REC_SETTINGS:
if(audio_stat != AUDIO_STATUS_RECORD)
{
-#ifdef HAVE_LED
+#if CONFIG_LED == LED_REAL
/* led is restored at begin of loop / end of function */
led(false);
#endif
@@ -607,7 +607,7 @@ bool recording_screen(void)
case REC_F2:
if(audio_stat != AUDIO_STATUS_RECORD)
{
-#ifdef HAVE_LED
+#if CONFIG_LED == LED_REAL
/* led is restored at begin of loop / end of function */
led(false);
#endif
@@ -633,7 +633,7 @@ bool recording_screen(void)
{
if(audio_stat != AUDIO_STATUS_RECORD)
{
-#ifdef HAVE_LED
+#if CONFIG_LED == LED_REAL
/* led is restored at begin of loop / end of function */
led(false);
#endif
@@ -839,7 +839,7 @@ bool recording_screen(void)
if (have_recorded)
reload_directory();
-#if defined(HAVE_LED) && !defined(SIMULATOR)
+#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(true);
#endif
return been_in_usb_mode;
diff --git a/apps/status.c b/apps/status.c
index d7d3a21..8d3d174 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -60,7 +60,7 @@ struct status_info {
bool keylock;
bool battery_safe;
bool redraw_volume; /* true if the volume gauge needs updating */
-#ifndef HAVE_LED
+#if CONFIG_LED == LED_VIRTUAL
bool led; /* disk LED simulation in the status bar */
#endif
};
@@ -167,7 +167,7 @@ void status_draw(bool force_redraw)
#endif
info.repeat = global_settings.repeat_mode;
info.playmode = current_playmode();
-#ifndef HAVE_LED
+#if CONFIG_LED == LED_VIRTUAL
info.led = led_read(HZ/2); /* delay should match polling interval */
#endif
@@ -248,7 +248,7 @@ void status_draw(bool force_redraw)
#ifdef HAVE_RTC
statusbar_time(info.hour, info.minute);
#endif
-#ifndef HAVE_LED
+#if CONFIG_LED == LED_VIRTUAL
if (info.led)
statusbar_led();
#endif
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 542081b..4bf22ff 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 c8ad3b3..9bf1815 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 4598175..ca4aada 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 2043de9..e9dc54c 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 ec410cb..b7f8621 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 473f1cf..f1c20ee 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 431cf2f..5cf8a76 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 cce88e5..2380f22 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 58cb408..66062fa 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 8b85bfd..eee9e97 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 a3a354fe..61c76d4 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 b9a0118..e042a78 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 56001e3..6faaa49 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 052da26..f1b3b95 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 bc46c82..37a185f 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;