diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-11-28 22:46:19 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-11-28 22:46:19 +0000 |
commit | 2b77b4fdd50f8ff150181f973767afa9dd4b7b22 (patch) | |
tree | ab79fd272adfcf6d3be85270bd40c946d3cb1a1a /firmware/drivers | |
parent | 494d261de33a6058af6bb5ae6f2965381a127b68 (diff) | |
download | rockbox-2b77b4fdd50f8ff150181f973767afa9dd4b7b22.tar.gz rockbox-2b77b4fdd50f8ff150181f973767afa9dd4b7b22.zip |
Added option to enable/disable disk poweroff (for diagnostic purposes)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2888 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 15 | ||||
-rw-r--r-- | firmware/drivers/ata.h | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 8ca3b75adb..216bf180bf 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -411,6 +411,14 @@ void ata_spindown(int seconds) | |||
411 | sleep_timeout = seconds * HZ; | 411 | sleep_timeout = seconds * HZ; |
412 | } | 412 | } |
413 | 413 | ||
414 | void ata_poweroff(bool enable) | ||
415 | { | ||
416 | if (enable) | ||
417 | poweroff_timeout = 2*HZ; | ||
418 | else | ||
419 | poweroff_timeout = 0; | ||
420 | } | ||
421 | |||
414 | bool ata_disk_is_active(void) | 422 | bool ata_disk_is_active(void) |
415 | { | 423 | { |
416 | return !sleeping; | 424 | return !sleeping; |
@@ -487,8 +495,13 @@ static void ata_thread(void) | |||
487 | queue_wait(&ata_queue, &ev); | 495 | queue_wait(&ata_queue, &ev); |
488 | switch ( ev.id ) { | 496 | switch ( ev.id ) { |
489 | case SYS_USB_CONNECTED: | 497 | case SYS_USB_CONNECTED: |
490 | if (poweroff) | 498 | if (poweroff) { |
499 | mutex_lock(&ata_mtx); | ||
500 | led(true); | ||
491 | ata_power_on(); | 501 | ata_power_on(); |
502 | led(false); | ||
503 | mutex_unlock(&ata_mtx); | ||
504 | } | ||
492 | 505 | ||
493 | /* Tell the USB thread that we are safe */ | 506 | /* Tell the USB thread that we are safe */ |
494 | DEBUGF("ata_thread got SYS_USB_CONNECTED\n"); | 507 | DEBUGF("ata_thread got SYS_USB_CONNECTED\n"); |
diff --git a/firmware/drivers/ata.h b/firmware/drivers/ata.h index df4461e2f5..4a24cff412 100644 --- a/firmware/drivers/ata.h +++ b/firmware/drivers/ata.h | |||
@@ -34,6 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | extern void ata_enable(bool on); | 35 | extern void ata_enable(bool on); |
36 | extern void ata_spindown(int seconds); | 36 | extern void ata_spindown(int seconds); |
37 | extern void ata_poweroff(bool enable); | ||
37 | extern int ata_sleep(void); | 38 | extern int ata_sleep(void); |
38 | extern bool ata_disk_is_active(void); | 39 | extern bool ata_disk_is_active(void); |
39 | extern int ata_hard_reset(void); | 40 | extern int ata_hard_reset(void); |