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) | |
download | rockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.tar.gz rockbox-5690f78fb23ec66aeadf5ecf8200b5610b3e59d2.zip |
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 | |||
52 | #endif | 52 | #endif |
53 | #endif | 53 | #endif |
54 | drivers/power.c | 54 | drivers/power.c |
55 | #ifdef CONFIG_LED | ||
55 | drivers/led.c | 56 | drivers/led.c |
57 | #endif | ||
56 | #ifndef SIMULATOR | 58 | #ifndef SIMULATOR |
57 | drivers/adc.c | 59 | drivers/adc.c |
58 | #ifdef HAVE_MMC | 60 | #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; | |||
241 | 241 | ||
242 | bool old_recorder = false; | 242 | bool old_recorder = false; |
243 | int ata_spinup_time = 0; | 243 | int ata_spinup_time = 0; |
244 | #ifdef CONFIG_LED | ||
244 | static bool ata_led_enabled = true; | 245 | static bool ata_led_enabled = true; |
245 | static bool ata_led_on = false; | 246 | static bool ata_led_on = false; |
247 | #endif | ||
246 | static bool spinup = false; | 248 | static bool spinup = false; |
247 | static bool sleeping = true; | 249 | static bool sleeping = true; |
248 | static long sleep_timeout = 5*HZ; | 250 | static long sleep_timeout = 5*HZ; |
@@ -475,12 +477,16 @@ static void copy_read_sectors(unsigned char* buf, int wordcount) | |||
475 | #endif | 477 | #endif |
476 | } | 478 | } |
477 | 479 | ||
480 | #ifdef CONFIG_LED | ||
478 | static void ata_led(bool on) { | 481 | static void ata_led(bool on) { |
479 | ata_led_on = on; | 482 | ata_led_on = on; |
480 | if (ata_led_enabled) { | 483 | if (ata_led_enabled) { |
481 | led(ata_led_on); | 484 | led(ata_led_on); |
482 | } | 485 | } |
483 | } | 486 | } |
487 | #else | ||
488 | #define ata_led(on) | ||
489 | #endif | ||
484 | 490 | ||
485 | int ata_read_sectors(IF_MV2(int drive,) | 491 | int ata_read_sectors(IF_MV2(int drive,) |
486 | unsigned long start, | 492 | unsigned long start, |
@@ -1468,6 +1474,7 @@ int ata_init(void) | |||
1468 | return 0; | 1474 | return 0; |
1469 | } | 1475 | } |
1470 | 1476 | ||
1477 | #if CONFIG_LED == LED_REAL | ||
1471 | void ata_set_led_enabled(bool enabled) { | 1478 | void ata_set_led_enabled(bool enabled) { |
1472 | ata_led_enabled = enabled; | 1479 | ata_led_enabled = enabled; |
1473 | if (ata_led_enabled) { | 1480 | if (ata_led_enabled) { |
@@ -1476,3 +1483,4 @@ void ata_set_led_enabled(bool enabled) { | |||
1476 | led(false); | 1483 | led(false); |
1477 | } | 1484 | } |
1478 | } | 1485 | } |
1486 | #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 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | 25 | ||
26 | static bool current; | 26 | #if CONFIG_LED == LED_REAL |
27 | |||
28 | #ifdef HAVE_LED | ||
29 | |||
30 | static bool xor; | ||
31 | 27 | ||
32 | void led(bool on) | 28 | void led(bool on) |
33 | { | 29 | { |
34 | current = on; | 30 | if ( on ) |
35 | if ( on ^ xor ) | ||
36 | #ifdef GMINI_ARCH | 31 | #ifdef GMINI_ARCH |
37 | P2 |= 1; | 32 | P2 |= 1; |
38 | else | 33 | else |
@@ -48,21 +43,9 @@ void led(bool on) | |||
48 | #endif | 43 | #endif |
49 | } | 44 | } |
50 | 45 | ||
51 | void invert_led(bool on) | 46 | #elif CONFIG_LED == LED_VIRTUAL |
52 | { | ||
53 | if ( on ) | ||
54 | { | ||
55 | xor = 1; | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | xor = 0; | ||
60 | } | ||
61 | led(current); | ||
62 | } | ||
63 | |||
64 | #else /* no LED, just status update */ | ||
65 | 47 | ||
48 | static bool current; | ||
66 | static long last_on; /* timestamp of switching off */ | 49 | static long last_on; /* timestamp of switching off */ |
67 | 50 | ||
68 | void led(bool on) | 51 | void led(bool on) |
@@ -74,15 +57,10 @@ void led(bool on) | |||
74 | current = on; | 57 | current = on; |
75 | } | 58 | } |
76 | 59 | ||
77 | void invert_led(bool on) | ||
78 | { | ||
79 | (void)on; /* no invert feature */ | ||
80 | } | ||
81 | |||
82 | bool led_read(int delayticks) /* read by status bar update */ | 60 | bool led_read(int delayticks) /* read by status bar update */ |
83 | { | 61 | { |
84 | /* reading "off" is delayed by user-supplied monoflop value */ | 62 | /* reading "off" is delayed by user-supplied monoflop value */ |
85 | return (current || TIME_BEFORE(current_tick, last_on+delayticks)); | 63 | return (current || TIME_BEFORE(current_tick, last_on+delayticks)); |
86 | } | 64 | } |
87 | 65 | ||
88 | #endif // #ifdef HAVE_LED | 66 | #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, | |||
61 | extern void ata_delayed_write(unsigned long sector, const void* buf); | 61 | extern void ata_delayed_write(unsigned long sector, const void* buf); |
62 | extern void ata_flush(void); | 62 | extern void ata_flush(void); |
63 | extern void ata_spin(void); | 63 | extern void ata_spin(void); |
64 | #if CONFIG_LED == LED_REAL | ||
64 | extern void ata_set_led_enabled(bool enabled); | 65 | extern void ata_set_led_enabled(bool enabled); |
66 | #endif | ||
65 | extern unsigned short* ata_get_identify(void); | 67 | extern unsigned short* ata_get_identify(void); |
66 | 68 | ||
67 | extern long last_disk_activity; | 69 | 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 @@ | |||
67 | /* The start address index for ROM builds */ | 67 | /* The start address index for ROM builds */ |
68 | #define ROM_START 0x14010 | 68 | #define ROM_START 0x14010 |
69 | 69 | ||
70 | /* Define this for programmable LED available */ | 70 | /* Software controlled LED */ |
71 | #define HAVE_LED | 71 | #define CONFIG_LED LED_REAL |
72 | 72 | ||
73 | /* Define this for LCD backlight available */ | 73 | /* Define this for LCD backlight available */ |
74 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 74 | #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 @@ | |||
54 | 54 | ||
55 | #define GMINI_ARCH | 55 | #define GMINI_ARCH |
56 | 56 | ||
57 | #define HAVE_LED | 57 | /* Software controlled LED */ |
58 | #define CONFIG_LED LED_REAL | ||
58 | 59 | ||
59 | /* Define this if you have adjustable CPU frequency */ | 60 | /* Define this if you have adjustable CPU frequency */ |
60 | #define HAVE_ADJUSTABLE_CPU_FREQ | 61 | #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 @@ | |||
48 | 48 | ||
49 | #define GMINI_ARCH | 49 | #define GMINI_ARCH |
50 | 50 | ||
51 | #define HAVE_LED | 51 | /* Software controlled LED */ |
52 | #define CONFIG_LED LED_REAL | ||
52 | 53 | ||
53 | /* Define this if you have adjustable CPU frequency */ | 54 | /* Define this if you have adjustable CPU frequency */ |
54 | #define HAVE_ADJUSTABLE_CPU_FREQ | 55 | #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 @@ | |||
85 | /* define this if media can be exchanged on the fly */ | 85 | /* define this if media can be exchanged on the fly */ |
86 | #define HAVE_HOTSWAP | 86 | #define HAVE_HOTSWAP |
87 | 87 | ||
88 | /* Virtual LED (icon) */ | ||
89 | #define CONFIG_LED LED_VIRTUAL | ||
90 | |||
88 | #define CONFIG_LCD LCD_SSD1815 | 91 | #define CONFIG_LCD LCD_SSD1815 |
89 | 92 | ||
90 | #define BOOTFILE_EXT ".ajz" | 93 | #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 @@ | |||
73 | /* define this if media can be exchanged on the fly */ | 73 | /* define this if media can be exchanged on the fly */ |
74 | #define HAVE_HOTSWAP | 74 | #define HAVE_HOTSWAP |
75 | 75 | ||
76 | /* Virtual LED (icon) */ | ||
77 | #define CONFIG_LED LED_VIRTUAL | ||
78 | |||
76 | #define CONFIG_LCD LCD_SSD1815 | 79 | #define CONFIG_LCD LCD_SSD1815 |
77 | 80 | ||
78 | #define BOOTFILE_EXT ".ajz" | 81 | #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 @@ | |||
60 | /* The start address index for ROM builds */ | 60 | /* The start address index for ROM builds */ |
61 | #define ROM_START 0xD010 | 61 | #define ROM_START 0xD010 |
62 | 62 | ||
63 | /* Define this for programmable LED available */ | 63 | /* Software controlled LED */ |
64 | #define HAVE_LED | 64 | #define CONFIG_LED LED_REAL |
65 | 65 | ||
66 | /* Define this for LCD backlight available */ | 66 | /* Define this for LCD backlight available */ |
67 | #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ | 67 | #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 @@ | |||
61 | /* The start address index for ROM builds */ | 61 | /* The start address index for ROM builds */ |
62 | #define ROM_START 0x11010 | 62 | #define ROM_START 0x11010 |
63 | 63 | ||
64 | /* Define this for programmable LED available */ | 64 | /* Software controlled LED */ |
65 | #define HAVE_LED | 65 | #define CONFIG_LED LED_REAL |
66 | 66 | ||
67 | /* Define this for LCD backlight available */ | 67 | /* Define this for LCD backlight available */ |
68 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 68 | #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 @@ | |||
67 | /* The start address index for ROM builds */ | 67 | /* The start address index for ROM builds */ |
68 | #define ROM_START 0x12010 | 68 | #define ROM_START 0x12010 |
69 | 69 | ||
70 | /* Define this for programmable LED available */ | 70 | /* Software controlled LED */ |
71 | #define HAVE_LED | 71 | #define CONFIG_LED LED_REAL |
72 | 72 | ||
73 | /* Define this for LCD backlight available */ | 73 | /* Define this for LCD backlight available */ |
74 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 74 | #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 @@ | |||
74 | #define I2C_GMINI 2 /* Gmini style */ | 74 | #define I2C_GMINI 2 /* Gmini style */ |
75 | #define I2C_H100 3 /* iRiver h100 style */ | 75 | #define I2C_H100 3 /* iRiver h100 style */ |
76 | 76 | ||
77 | /* CONFIG_LED */ | ||
78 | #define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */ | ||
79 | #define LED_VIRTUAL 2 /* Virtual LED (icon) (Archos Ondio) */ | ||
80 | /* else HW controlled LED (iRiver H1x0) */ | ||
81 | |||
77 | /* now go and pick yours */ | 82 | /* now go and pick yours */ |
78 | #if defined(ARCHOS_PLAYER) | 83 | #if defined(ARCHOS_PLAYER) |
79 | #include "config-player.h" | 84 | #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 @@ | |||
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | 24 | ||
25 | extern void led( bool on ); | 25 | extern void led( bool on ); |
26 | extern void invert_led( bool on ); | 26 | #if CONFIG_LED == LED_VIRTUAL |
27 | #ifndef HAVE_LED | ||
28 | extern bool led_read(int delayticks); /* read for status bar */ | 27 | extern bool led_read(int delayticks); /* read for status bar */ |
29 | #endif | 28 | #endif |
30 | 29 | ||
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, ...) | |||
36 | va_list ap; | 36 | va_list ap; |
37 | 37 | ||
38 | #ifndef SIMULATOR | 38 | #ifndef SIMULATOR |
39 | #if CONFIG_LED == LED_REAL | ||
39 | bool state = false; | 40 | bool state = false; |
41 | #endif | ||
40 | 42 | ||
41 | /* Disable interrupts */ | 43 | /* Disable interrupts */ |
42 | #if CONFIG_CPU == SH7034 | 44 | #if CONFIG_CPU == SH7034 |
@@ -76,7 +78,7 @@ void panicf( const char *fmt, ...) | |||
76 | DEBUGF(panic_buf); | 78 | DEBUGF(panic_buf); |
77 | while (1) | 79 | while (1) |
78 | { | 80 | { |
79 | #ifndef SIMULATOR | 81 | #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) |
80 | volatile long i; | 82 | volatile long i; |
81 | led (state); | 83 | led (state); |
82 | state = state?false:true; | 84 | state = state?false:true; |