summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-11-28 22:46:19 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-11-28 22:46:19 +0000
commit2b77b4fdd50f8ff150181f973767afa9dd4b7b22 (patch)
treeab79fd272adfcf6d3be85270bd40c946d3cb1a1a /firmware/drivers/ata.c
parent494d261de33a6058af6bb5ae6f2965381a127b68 (diff)
downloadrockbox-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/ata.c')
-rw-r--r--firmware/drivers/ata.c15
1 files changed, 14 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
414void ata_poweroff(bool enable)
415{
416 if (enable)
417 poweroff_timeout = 2*HZ;
418 else
419 poweroff_timeout = 0;
420}
421
414bool ata_disk_is_active(void) 422bool 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");