summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-04-04 09:12:12 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-04-04 09:12:12 +0000
commit68482bbed286981a5ef09a466620e459790c96e6 (patch)
treede613ede8a83077b935debc1ec3edd965d5d6090 /firmware
parent5fb6c64ffc8e6ab7512d805d2860831e492e5c52 (diff)
downloadrockbox-68482bbed286981a5ef09a466620e459790c96e6.zip
rockbox-68482bbed286981a5ef09a466620e459790c96e6.tar.gz
rockbox-68482bbed286981a5ef09a466620e459790c96e6.tar.bz2
rockbox-68482bbed286981a5ef09a466620e459790c96e6.tar.xz
Patch #868645 by Philipp Pertermann, volume triggered recording for the Archos recording devices
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6243 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c44
-rw-r--r--firmware/export/ata.h1
2 files changed, 32 insertions, 13 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 10f5f20..956f61d 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -241,6 +241,8 @@ static volatile unsigned char* ata_control;
bool old_recorder = false;
int ata_spinup_time = 0;
+static bool ata_led_enabled = true;
+static bool ata_led_on = false;
static bool spinup = false;
static bool sleeping = true;
static long sleep_timeout = 5*HZ;
@@ -473,6 +475,13 @@ static void copy_read_sectors(unsigned char* buf, int wordcount)
#endif
}
+static void ata_led(bool on) {
+ ata_led_on = on;
+ if (ata_led_enabled) {
+ led(ata_led_on);
+ }
+}
+
int ata_read_sectors(IF_MV2(int drive,)
unsigned long start,
int incount,
@@ -492,21 +501,21 @@ int ata_read_sectors(IF_MV2(int drive,)
last_disk_activity = current_tick;
spinup_start = current_tick;
- led(true);
+ ata_led(true);
if ( sleeping ) {
spinup = true;
if (poweroff) {
if (ata_power_on()) {
mutex_unlock(&ata_mtx);
- led(false);
+ ata_led(false);
return -1;
}
}
else {
if (perform_soft_reset()) {
mutex_unlock(&ata_mtx);
- led(false);
+ ata_led(false);
return -1;
}
}
@@ -518,7 +527,7 @@ int ata_read_sectors(IF_MV2(int drive,)
if (!wait_for_rdy())
{
mutex_unlock(&ata_mtx);
- led(false);
+ ata_led(false);
return -2;
}
@@ -614,7 +623,7 @@ int ata_read_sectors(IF_MV2(int drive,)
}
break;
}
- led(false);
+ ata_led(false);
mutex_unlock(&ata_mtx);
@@ -775,21 +784,21 @@ int ata_write_sectors(IF_MV2(int drive,)
last_disk_activity = current_tick;
spinup_start = current_tick;
- led(true);
+ ata_led(true);
if ( sleeping ) {
spinup = true;
if (poweroff) {
if (ata_power_on()) {
mutex_unlock(&ata_mtx);
- led(false);
+ ata_led(false);
return -1;
}
}
else {
if (perform_soft_reset()) {
mutex_unlock(&ata_mtx);
- led(false);
+ ata_led(false);
return -1;
}
}
@@ -799,7 +808,7 @@ int ata_write_sectors(IF_MV2(int drive,)
if (!wait_for_rdy())
{
mutex_unlock(&ata_mtx);
- led(false);
+ ata_led(false);
return -2;
}
@@ -843,7 +852,7 @@ int ata_write_sectors(IF_MV2(int drive,)
ret = -4;
}
- led(false);
+ ata_led(false);
mutex_unlock(&ata_mtx);
@@ -1042,9 +1051,9 @@ static void ata_thread(void)
case SYS_USB_CONNECTED:
if (poweroff) {
mutex_lock(&ata_mtx);
- led(true);
+ ata_led(true);
ata_power_on();
- led(false);
+ ata_led(false);
mutex_unlock(&ata_mtx);
}
@@ -1384,7 +1393,7 @@ int ata_init(void)
mutex_init(&ata_mtx);
- led(false);
+ ata_led(false);
#if CONFIG_CPU == SH7034
/* Port A setup */
@@ -1458,3 +1467,12 @@ int ata_init(void)
return 0;
}
+
+void ata_set_led_enabled(bool enabled) {
+ ata_led_enabled = enabled;
+ if (ata_led_enabled) {
+ led(ata_led_on);
+ } else {
+ led(false);
+ }
+}
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index fb604a1..2043de9 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -61,6 +61,7 @@ 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);
+extern void ata_set_led_enabled(bool enabled);
extern unsigned short* ata_get_identify(void);
extern long last_disk_activity;