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
This commit is contained in:
Jens Arnold 2005-06-04 23:15:52 +00:00
parent c9cc73ec19
commit 5690f78fb2
20 changed files with 62 additions and 56 deletions

View file

@ -277,7 +277,7 @@ void init(void)
#ifdef AUTOROCK #ifdef AUTOROCK
if (!usb_detect()) if (!usb_detect())
{ {
int fd; int fd;
static const char filename[] = PLUGIN_DIR "/autostart.rock"; static const char filename[] = PLUGIN_DIR "/autostart.rock";
@ -303,8 +303,10 @@ int main(void)
app_main(); app_main();
while(1) { while(1) {
#if CONFIG_LED == LED_REAL
led(true); sleep(HZ/10); led(true); sleep(HZ/10);
led(false); sleep(HZ/10); led(false); sleep(HZ/10);
#endif
} }
return 0; return 0;
} }

View file

@ -74,7 +74,7 @@ const unsigned char bitmap_icons_7x8[][7] =
{0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */ {0x20,0x30,0x38,0x3c,0x38,0x30,0x20}, /* Up-arrow */
}; };
#ifndef HAVE_LED #if CONFIG_LED == LED_VIRTUAL
/* Disk/MMC activity */ /* Disk/MMC activity */
const unsigned char bitmap_icon_disk[12] = const unsigned char bitmap_icon_disk[12] =
{0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; {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); STATUSBAR_Y_POS, 5, 8, false);
} }
#ifndef HAVE_LED #if CONFIG_LED == LED_VIRTUAL
/* /*
* no real LED: disk activity in status bar * no real LED: disk activity in status bar
*/ */

View file

@ -63,7 +63,7 @@ enum icons_7x8 {
extern const unsigned char bitmap_icons_5x8[1][5]; extern const unsigned char bitmap_icons_5x8[1][5];
extern const unsigned char bitmap_icons_6x8[LastIcon][6]; extern const unsigned char bitmap_icons_6x8[LastIcon][6];
extern const unsigned char bitmap_icons_7x8[Icon_Last][7]; 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[]; extern const unsigned char bitmap_icon_disk[];
#endif #endif
@ -106,7 +106,7 @@ extern void statusbar_icon_lock(void);
#ifdef HAVE_RTC #ifdef HAVE_RTC
extern void statusbar_time(int hour, int minute); extern void statusbar_time(int hour, int minute);
#endif #endif
#ifndef HAVE_LED #if CONFIG_LED == LED_VIRTUAL
extern void statusbar_led(void); extern void statusbar_led(void);
#endif #endif

View file

@ -307,7 +307,7 @@ bool recording_screen(void)
char path_buffer[MAX_PATH]; char path_buffer[MAX_PATH];
bool been_in_usb_mode = false; bool been_in_usb_mode = false;
int last_audio_stat = -1; int last_audio_stat = -1;
#ifdef HAVE_LED #if CONFIG_LED == LED_REAL
bool led_state = false; bool led_state = false;
int led_countdown = 2; int led_countdown = 2;
#endif #endif
@ -320,7 +320,7 @@ bool recording_screen(void)
}; };
cursor = 0; cursor = 0;
#if defined(HAVE_LED) && !defined(SIMULATOR) #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(false); ata_set_led_enabled(false);
#endif #endif
mpeg_init_recording(); mpeg_init_recording();
@ -356,7 +356,7 @@ bool recording_screen(void)
while(!done) while(!done)
{ {
int audio_stat = audio_status(); int audio_stat = audio_status();
#ifdef HAVE_LED #if CONFIG_LED == LED_REAL
/* /*
* Flash the LED while waiting to record. Turn it on while * Flash the LED while waiting to record. Turn it on while
@ -401,7 +401,7 @@ bool recording_screen(void)
led(false); led(false);
} }
} }
#endif /* HAVE_LED */ #endif /* CONFIG_LED */
/* Wait for a button a while (HZ/10) drawing the peak meter */ /* 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); button = peak_meter_draw_get_btn(0, 8 + h*2, LCD_WIDTH, h);
@ -574,7 +574,7 @@ bool recording_screen(void)
case REC_SETTINGS: case REC_SETTINGS:
if(audio_stat != AUDIO_STATUS_RECORD) 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 is restored at begin of loop / end of function */
led(false); led(false);
#endif #endif
@ -607,7 +607,7 @@ bool recording_screen(void)
case REC_F2: case REC_F2:
if(audio_stat != AUDIO_STATUS_RECORD) 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 is restored at begin of loop / end of function */
led(false); led(false);
#endif #endif
@ -633,7 +633,7 @@ bool recording_screen(void)
{ {
if(audio_stat != AUDIO_STATUS_RECORD) 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 is restored at begin of loop / end of function */
led(false); led(false);
#endif #endif
@ -839,7 +839,7 @@ bool recording_screen(void)
if (have_recorded) if (have_recorded)
reload_directory(); reload_directory();
#if defined(HAVE_LED) && !defined(SIMULATOR) #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(true); ata_set_led_enabled(true);
#endif #endif
return been_in_usb_mode; return been_in_usb_mode;

View file

@ -60,7 +60,7 @@ struct status_info {
bool keylock; bool keylock;
bool battery_safe; bool battery_safe;
bool redraw_volume; /* true if the volume gauge needs updating */ 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 */ bool led; /* disk LED simulation in the status bar */
#endif #endif
}; };
@ -167,7 +167,7 @@ void status_draw(bool force_redraw)
#endif #endif
info.repeat = global_settings.repeat_mode; info.repeat = global_settings.repeat_mode;
info.playmode = current_playmode(); info.playmode = current_playmode();
#ifndef HAVE_LED #if CONFIG_LED == LED_VIRTUAL
info.led = led_read(HZ/2); /* delay should match polling interval */ info.led = led_read(HZ/2); /* delay should match polling interval */
#endif #endif
@ -248,7 +248,7 @@ void status_draw(bool force_redraw)
#ifdef HAVE_RTC #ifdef HAVE_RTC
statusbar_time(info.hour, info.minute); statusbar_time(info.hour, info.minute);
#endif #endif
#ifndef HAVE_LED #if CONFIG_LED == LED_VIRTUAL
if (info.led) if (info.led)
statusbar_led(); statusbar_led();
#endif #endif

View file

@ -52,7 +52,9 @@ drivers/lcd-recorder.c
#endif #endif
#endif #endif
drivers/power.c drivers/power.c
#ifdef CONFIG_LED
drivers/led.c drivers/led.c
#endif
#ifndef SIMULATOR #ifndef SIMULATOR
drivers/adc.c drivers/adc.c
#ifdef HAVE_MMC #ifdef HAVE_MMC

View file

@ -241,8 +241,10 @@ static volatile unsigned char* ata_control;
bool old_recorder = false; bool old_recorder = false;
int ata_spinup_time = 0; int ata_spinup_time = 0;
#ifdef CONFIG_LED
static bool ata_led_enabled = true; static bool ata_led_enabled = true;
static bool ata_led_on = false; static bool ata_led_on = false;
#endif
static bool spinup = false; static bool spinup = false;
static bool sleeping = true; static bool sleeping = true;
static long sleep_timeout = 5*HZ; static long sleep_timeout = 5*HZ;
@ -475,12 +477,16 @@ static void copy_read_sectors(unsigned char* buf, int wordcount)
#endif #endif
} }
#ifdef CONFIG_LED
static void ata_led(bool on) { static void ata_led(bool on) {
ata_led_on = on; ata_led_on = on;
if (ata_led_enabled) { if (ata_led_enabled) {
led(ata_led_on); led(ata_led_on);
} }
} }
#else
#define ata_led(on)
#endif
int ata_read_sectors(IF_MV2(int drive,) int ata_read_sectors(IF_MV2(int drive,)
unsigned long start, unsigned long start,
@ -1468,6 +1474,7 @@ int ata_init(void)
return 0; return 0;
} }
#if CONFIG_LED == LED_REAL
void ata_set_led_enabled(bool enabled) { void ata_set_led_enabled(bool enabled) {
ata_led_enabled = enabled; ata_led_enabled = enabled;
if (ata_led_enabled) { if (ata_led_enabled) {
@ -1476,3 +1483,4 @@ void ata_set_led_enabled(bool enabled) {
led(false); led(false);
} }
} }
#endif

View file

@ -23,16 +23,11 @@
#include "system.h" #include "system.h"
#include "kernel.h" #include "kernel.h"
static bool current; #if CONFIG_LED == LED_REAL
#ifdef HAVE_LED
static bool xor;
void led(bool on) void led(bool on)
{ {
current = on; if ( on )
if ( on ^ xor )
#ifdef GMINI_ARCH #ifdef GMINI_ARCH
P2 |= 1; P2 |= 1;
else else
@ -48,21 +43,9 @@ void led(bool on)
#endif #endif
} }
void invert_led(bool on) #elif CONFIG_LED == LED_VIRTUAL
{
if ( on )
{
xor = 1;
}
else
{
xor = 0;
}
led(current);
}
#else /* no LED, just status update */
static bool current;
static long last_on; /* timestamp of switching off */ static long last_on; /* timestamp of switching off */
void led(bool on) void led(bool on)
@ -74,15 +57,10 @@ void led(bool on)
current = on; current = on;
} }
void invert_led(bool on)
{
(void)on; /* no invert feature */
}
bool led_read(int delayticks) /* read by status bar update */ bool led_read(int delayticks) /* read by status bar update */
{ {
/* reading "off" is delayed by user-supplied monoflop value */ /* reading "off" is delayed by user-supplied monoflop value */
return (current || TIME_BEFORE(current_tick, last_on+delayticks)); return (current || TIME_BEFORE(current_tick, last_on+delayticks));
} }
#endif // #ifdef HAVE_LED #endif /* CONFIG_LED */

View file

@ -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_delayed_write(unsigned long sector, const void* buf);
extern void ata_flush(void); extern void ata_flush(void);
extern void ata_spin(void); extern void ata_spin(void);
#if CONFIG_LED == LED_REAL
extern void ata_set_led_enabled(bool enabled); extern void ata_set_led_enabled(bool enabled);
#endif
extern unsigned short* ata_get_identify(void); extern unsigned short* ata_get_identify(void);
extern long last_disk_activity; extern long last_disk_activity;

View file

@ -67,8 +67,8 @@
/* The start address index for ROM builds */ /* The start address index for ROM builds */
#define ROM_START 0x14010 #define ROM_START 0x14010
/* Define this for programmable LED available */ /* Software controlled LED */
#define HAVE_LED #define CONFIG_LED LED_REAL
/* Define this for LCD backlight available */ /* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */

View file

@ -54,7 +54,8 @@
#define GMINI_ARCH #define GMINI_ARCH
#define HAVE_LED /* Software controlled LED */
#define CONFIG_LED LED_REAL
/* Define this if you have adjustable CPU frequency */ /* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ #define HAVE_ADJUSTABLE_CPU_FREQ

View file

@ -48,7 +48,8 @@
#define GMINI_ARCH #define GMINI_ARCH
#define HAVE_LED /* Software controlled LED */
#define CONFIG_LED LED_REAL
/* Define this if you have adjustable CPU frequency */ /* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ #define HAVE_ADJUSTABLE_CPU_FREQ

View file

@ -85,6 +85,9 @@
/* define this if media can be exchanged on the fly */ /* define this if media can be exchanged on the fly */
#define HAVE_HOTSWAP #define HAVE_HOTSWAP
/* Virtual LED (icon) */
#define CONFIG_LED LED_VIRTUAL
#define CONFIG_LCD LCD_SSD1815 #define CONFIG_LCD LCD_SSD1815
#define BOOTFILE_EXT ".ajz" #define BOOTFILE_EXT ".ajz"

View file

@ -73,6 +73,9 @@
/* define this if media can be exchanged on the fly */ /* define this if media can be exchanged on the fly */
#define HAVE_HOTSWAP #define HAVE_HOTSWAP
/* Virtual LED (icon) */
#define CONFIG_LED LED_VIRTUAL
#define CONFIG_LCD LCD_SSD1815 #define CONFIG_LCD LCD_SSD1815
#define BOOTFILE_EXT ".ajz" #define BOOTFILE_EXT ".ajz"

View file

@ -60,8 +60,8 @@
/* The start address index for ROM builds */ /* The start address index for ROM builds */
#define ROM_START 0xD010 #define ROM_START 0xD010
/* Define this for programmable LED available */ /* Software controlled LED */
#define HAVE_LED #define CONFIG_LED LED_REAL
/* Define this for LCD backlight available */ /* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */

View file

@ -61,8 +61,8 @@
/* The start address index for ROM builds */ /* The start address index for ROM builds */
#define ROM_START 0x11010 #define ROM_START 0x11010
/* Define this for programmable LED available */ /* Software controlled LED */
#define HAVE_LED #define CONFIG_LED LED_REAL
/* Define this for LCD backlight available */ /* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */

View file

@ -67,8 +67,8 @@
/* The start address index for ROM builds */ /* The start address index for ROM builds */
#define ROM_START 0x12010 #define ROM_START 0x12010
/* Define this for programmable LED available */ /* Software controlled LED */
#define HAVE_LED #define CONFIG_LED LED_REAL
/* Define this for LCD backlight available */ /* Define this for LCD backlight available */
#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */

View file

@ -74,6 +74,11 @@
#define I2C_GMINI 2 /* Gmini style */ #define I2C_GMINI 2 /* Gmini style */
#define I2C_H100 3 /* iRiver h100 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 */ /* now go and pick yours */
#if defined(ARCHOS_PLAYER) #if defined(ARCHOS_PLAYER)
#include "config-player.h" #include "config-player.h"

View file

@ -23,8 +23,7 @@
#include <stdbool.h> #include <stdbool.h>
extern void led( bool on ); extern void led( bool on );
extern void invert_led( bool on ); #if CONFIG_LED == LED_VIRTUAL
#ifndef HAVE_LED
extern bool led_read(int delayticks); /* read for status bar */ extern bool led_read(int delayticks); /* read for status bar */
#endif #endif

View file

@ -36,7 +36,9 @@ void panicf( const char *fmt, ...)
va_list ap; va_list ap;
#ifndef SIMULATOR #ifndef SIMULATOR
#if CONFIG_LED == LED_REAL
bool state = false; bool state = false;
#endif
/* Disable interrupts */ /* Disable interrupts */
#if CONFIG_CPU == SH7034 #if CONFIG_CPU == SH7034
@ -76,7 +78,7 @@ void panicf( const char *fmt, ...)
DEBUGF(panic_buf); DEBUGF(panic_buf);
while (1) while (1)
{ {
#ifndef SIMULATOR #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
volatile long i; volatile long i;
led (state); led (state);
state = state?false:true; state = state?false:true;