summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/ata.c8
-rw-r--r--firmware/drivers/led.c32
2 files changed, 13 insertions, 27 deletions
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
242bool old_recorder = false; 242bool old_recorder = false;
243int ata_spinup_time = 0; 243int ata_spinup_time = 0;
244#ifdef CONFIG_LED
244static bool ata_led_enabled = true; 245static bool ata_led_enabled = true;
245static bool ata_led_on = false; 246static bool ata_led_on = false;
247#endif
246static bool spinup = false; 248static bool spinup = false;
247static bool sleeping = true; 249static bool sleeping = true;
248static long sleep_timeout = 5*HZ; 250static 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
478static void ata_led(bool on) { 481static 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
485int ata_read_sectors(IF_MV2(int drive,) 491int 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
1471void ata_set_led_enabled(bool enabled) { 1478void 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
26static bool current; 26#if CONFIG_LED == LED_REAL
27
28#ifdef HAVE_LED
29
30static bool xor;
31 27
32void led(bool on) 28void 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
51void 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
48static bool current;
66static long last_on; /* timestamp of switching off */ 49static long last_on; /* timestamp of switching off */
67 50
68void led(bool on) 51void led(bool on)
@@ -74,15 +57,10 @@ void led(bool on)
74 current = on; 57 current = on;
75} 58}
76 59
77void invert_led(bool on)
78{
79 (void)on; /* no invert feature */
80}
81
82bool led_read(int delayticks) /* read by status bar update */ 60bool 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 */